# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.

defmodule GoogleApi.AdExchangeSeller.V20.Api.Accounts do
  @moduledoc """
  API calls for all endpoints tagged `Accounts`.
  """

  alias GoogleApi.AdExchangeSeller.V20.Connection
  alias GoogleApi.Gax.{Request, Response}

  @doc """
  List all ad clients in this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account to which the ad client belongs.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :maxResults (integer()): The maximum number of ad clients to include in the response, used for paging.
    - :pageToken (String.t): A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of \&quot;nextPageToken\&quot; from the previous response.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.AdClients{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_adclients_list(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.AdClients.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_adclients_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.AdClients{})
  end

  @doc """
  List the alerts for this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account owning the alerts.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :locale (String.t): The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Alerts{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_alerts_list(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.Alerts.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_alerts_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :locale => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/alerts", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Alerts{})
  end

  @doc """
  Get the specified custom channel from the specified ad client.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account to which the ad client belongs.
  - ad_client_id (String.t): Ad client which contains the custom channel.
  - custom_channel_id (String.t): Custom channel to retrieve.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.CustomChannel{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_customchannels_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.CustomChannel.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_customchannels_get(
        connection,
        account_id,
        ad_client_id,
        custom_channel_id,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}",
        %{
          "accountId" => URI.encode_www_form(account_id),
          "adClientId" => URI.encode_www_form(ad_client_id),
          "customChannelId" => URI.encode_www_form(custom_channel_id)
        }
      )
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.CustomChannel{})
  end

  @doc """
  List all custom channels in the specified ad client for this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account to which the ad client belongs.
  - ad_client_id (String.t): Ad client for which to list custom channels.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :maxResults (integer()): The maximum number of custom channels to include in the response, used for paging.
    - :pageToken (String.t): A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \&quot;nextPageToken\&quot; from the previous response.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.CustomChannels{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_customchannels_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.CustomChannels.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_customchannels_list(
        connection,
        account_id,
        ad_client_id,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/customchannels", %{
        "accountId" => URI.encode_www_form(account_id),
        "adClientId" => URI.encode_www_form(ad_client_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.CustomChannels{})
  end

  @doc """
  Get information about the selected Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account to get information about. Tip: &#39;myaccount&#39; is a valid ID.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Account{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_get(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.Account.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_get(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Account{})
  end

  @doc """
  List all accounts available to this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :maxResults (integer()): The maximum number of accounts to include in the response, used for paging.
    - :pageToken (String.t): A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of \&quot;nextPageToken\&quot; from the previous response.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Accounts{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_list(Tesla.Env.client(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.Accounts.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_list(connection, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts")
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Accounts{})
  end

  @doc """
  List the metadata for the dimensions available to this AdExchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account with visibility to the dimensions.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Metadata{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_metadata_dimensions_list(
          Tesla.Env.client(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.AdExchangeSeller.V20.Model.Metadata.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_metadata_dimensions_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/metadata/dimensions", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Metadata{})
  end

  @doc """
  List the metadata for the metrics available to this AdExchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account with visibility to the metrics.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Metadata{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_metadata_metrics_list(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.Metadata.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_metadata_metrics_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/metadata/metrics", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Metadata{})
  end

  @doc """
  Get information about the selected Ad Exchange Preferred Deal.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account owning the deal.
  - deal_id (String.t): Preferred deal to get information about.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.PreferredDeal{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_preferreddeals_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.PreferredDeal.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_preferreddeals_get(connection, account_id, deal_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/preferreddeals/{dealId}", %{
        "accountId" => URI.encode_www_form(account_id),
        "dealId" => URI.encode_www_form(deal_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.PreferredDeal{})
  end

  @doc """
  List the preferred deals for this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account owning the deals.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.PreferredDeals{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_preferreddeals_list(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.PreferredDeals.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_preferreddeals_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/preferreddeals", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.PreferredDeals{})
  end

  @doc """
  Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify \&quot;alt&#x3D;csv\&quot; as a query parameter.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account which owns the generated report.
  - start_date (String.t): Start of the date range to report on in \&quot;YYYY-MM-DD\&quot; format, inclusive.
  - end_date (String.t): End of the date range to report on in \&quot;YYYY-MM-DD\&quot; format, inclusive.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :dimension ([String.t]): Dimensions to base the report on.
    - :filter ([String.t]): Filters to be run on the report.
    - :locale (String.t): Optional locale to use for translating report output to a local language. Defaults to \&quot;en_US\&quot; if not specified.
    - :maxResults (integer()): The maximum number of rows of report data to return.
    - :metric ([String.t]): Numeric columns to include in the report.
    - :sort ([String.t]): The name of a dimension or metric to sort the resulting report on, optionally prefixed with \&quot;+\&quot; to sort ascending or \&quot;-\&quot; to sort descending. If no prefix is specified, the column is sorted ascending.
    - :startIndex (integer()): Index of the first row of report data to return.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Report{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_reports_generate(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.AdExchangeSeller.V20.Model.Report.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_reports_generate(
        connection,
        account_id,
        start_date,
        end_date,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :dimension => :query,
      :filter => :query,
      :locale => :query,
      :maxResults => :query,
      :metric => :query,
      :sort => :query,
      :startIndex => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/reports", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_param(:query, :startDate, start_date)
      |> Request.add_param(:query, :endDate, end_date)
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Report{})
  end

  @doc """
  Generate an Ad Exchange report based on the saved report ID sent in the query parameters.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account owning the saved report.
  - saved_report_id (String.t): The saved report to retrieve.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :locale (String.t): Optional locale to use for translating report output to a local language. Defaults to \&quot;en_US\&quot; if not specified.
    - :maxResults (integer()): The maximum number of rows of report data to return.
    - :startIndex (integer()): Index of the first row of report data to return.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.Report{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_reports_saved_generate(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.AdExchangeSeller.V20.Model.Report.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_reports_saved_generate(
        connection,
        account_id,
        saved_report_id,
        opts \\ []
      ) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :locale => :query,
      :maxResults => :query,
      :startIndex => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/reports/{savedReportId}", %{
        "accountId" => URI.encode_www_form(account_id),
        "savedReportId" => URI.encode_www_form(saved_report_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.Report{})
  end

  @doc """
  List all saved reports in this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account owning the saved reports.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :maxResults (integer()): The maximum number of saved reports to include in the response, used for paging.
    - :pageToken (String.t): A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of \&quot;nextPageToken\&quot; from the previous response.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.SavedReports{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_reports_saved_list(Tesla.Env.client(), String.t(), keyword()) ::
          {:ok, GoogleApi.AdExchangeSeller.V20.Model.SavedReports.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_reports_saved_list(connection, account_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/reports/saved", %{
        "accountId" => URI.encode_www_form(account_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.SavedReports{})
  end

  @doc """
  List all URL channels in the specified ad client for this Ad Exchange account.

  ## Parameters

  - connection (GoogleApi.AdExchangeSeller.V20.Connection): Connection to server
  - account_id (String.t): Account to which the ad client belongs.
  - ad_client_id (String.t): Ad client for which to list URL channels.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String.t): Data format for the response.
    - :fields (String.t): Selector specifying which fields to include in a partial response.
    - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String.t): OAuth 2.0 token for the current user.
    - :prettyPrint (boolean()): Returns response with indentations and line breaks.
    - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
    - :userIp (String.t): Deprecated. Please use quotaUser instead.
    - :maxResults (integer()): The maximum number of URL channels to include in the response, used for paging.
    - :pageToken (String.t): A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of \&quot;nextPageToken\&quot; from the previous response.

  ## Returns

  {:ok, %GoogleApi.AdExchangeSeller.V20.Model.UrlChannels{}} on success
  {:error, info} on failure
  """
  @spec adexchangeseller_accounts_urlchannels_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword()
        ) :: {:ok, GoogleApi.AdExchangeSeller.V20.Model.UrlChannels.t()} | {:error, Tesla.Env.t()}
  def adexchangeseller_accounts_urlchannels_list(connection, account_id, ad_client_id, opts \\ []) do
    optional_params = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/urlchannels", %{
        "accountId" => URI.encode_www_form(account_id),
        "adClientId" => URI.encode_www_form(ad_client_id)
      })
      |> Request.add_optional_params(optional_params, opts)

    connection
    |> Connection.execute(request)
    |> Response.decode(struct: %GoogleApi.AdExchangeSeller.V20.Model.UrlChannels{})
  end
end
